java为什么不推荐“使用getString()获取设备标识符”?
我正试图将我的设备ID设置为Logcat,但Android Studio给了我这个警告
using getstring to get device identifiers is not recommended
String deviceID = Settings.Secure.getString(getApplicationContext().getContentResolver(),
Settings.Secure.ANDROID_ID);
为什么不推荐
# 1 楼答案
完整的警告说:
我认为Android不建议使用这个值,因为它是一个永久的唯一id,可以用来跟踪你的用户,他或她不能更改这个id或阻止你阅读它。警告中给出的其他选项尊重用户的意愿。这就是为什么安卓建议你使用它
这真的取决于你将如何使用这个id。现在隐私是一件敏感的事情
请检查以下内容:
资料来源:https://developer.android.com/training/articles/user-data-ids.html